package com.af.system.tree;

import java.util.ArrayList;
import java.util.List;

/**
 * @author : zhenyun.su
 * @since : 2023/3/22
 * @Comment: 树形节点的抽象类AfTreeNode，其泛型参数类型限定为AfTreeNode的子类，并实现AfNodeable接口的方法
 * children成员的元素类型限定为AfTreeNode的子类
 */

public abstract class AfTreeNode<T extends AfTreeNode<T>> implements AfNodeable<T> {
	protected Long id;
	protected Long pid;
	protected Boolean leafed;
	protected List<? extends T> children = new ArrayList<>();

	@Override
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Override
	public Long getPid() {
		return pid;
	}

	public void setPid(Long pid) {
		this.pid = pid;
	}

	@Override
	public Boolean getLeafed() {
		return leafed;
	}

	@Override
	public void setLeafed(Boolean leafed) {
		this.leafed = leafed;
	}

	@Override
	public List<? extends T> getChildren() {
		return children;
	}

	@Override
	public void setChildren(List<? extends T> children) {
		this.children = children;
	}
}
